/*
 * FaceCat图形通讯框架(非开源)
 * 著作权编号:2015SR229355+2020SR0266727
 * 上海卷卷猫信息技术有限公司
 */

#include "stdafx.h"
#include "FCPaint.h"

namespace FaceCat{
    Long FCColor::rgb(int r, int g, int b){
        return ((r | (g << 8)) | (b << 0x10));
    }

    Long FCColor::rgba(int r, int g, int b, int a){
        if(a == 255){
            return ((r | (g << 8)) | (b << 0x10));
        }
        else if(a == 0){
            return FCColor_None;
        }
        else{
            int rgb = ((r | (g << 8)) | (b << 0x10));
            Long argb = -((Long)rgb * 1000 + a);
            return argb;
        }
    }
    
    void FCColor::toRgba(FCPaint *paint, Long dwPenColor, int *r, int *g, int *b, int *a){
        if(paint){
            dwPenColor = paint->getColor(dwPenColor);
        }
        *a = 255;
        if(dwPenColor < 0){
            dwPenColor = -dwPenColor;
            if(dwPenColor < 1){
                *a = 255;
            }
            else{
                *a = (int)(dwPenColor - dwPenColor / 1000 * 1000);
            }
            dwPenColor /= 1000;
        }
        *r = (int)(dwPenColor & 0xff);
        *g = (int)((dwPenColor >> 8) & 0xff);
        *b = (int)((dwPenColor >> 0x10) & 0xff);
    }
    
    Long FCColor::ratioColor(FCPaint *paint, Long originalColor, double ratio){
        int a = 0, r = 0, g = 0, b = 0;
        toRgba(paint, originalColor, &r, &g, &b, &a);
        r = (int)(r * ratio);
        g = (int)(g * ratio);
        b = (int)(b * ratio);
        if (r > 255) r = 255;
        if (g > 255) g = 255;
        if (b > 255) b = 255;
        return rgba(r, g, b, a);
    }
    
    Long FCColor::reverse(FCPaint *paint, Long originalColor){
        int a = 0, r = 0, g = 0, b = 0;
        toRgba(paint, originalColor, &r, &g, &b, &a);
        return rgba(255 - r, 255 - g, 255 - b, a);
    }
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    FCPaint::FCPaint(){
    }
    
    FCPaint::~FCPaint(){
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void FCPaint::addArc(const FCRect& rect, float startAngle, float sweepAngle){
    }
    
    void FCPaint::addBezier(FCPoint *apt, int cpt){
    }
    
    void FCPaint::addCurve(FCPoint *apt, int cpt){
    }
    
    void FCPaint::addEllipse(const FCRect& rect){
    }
    
    void FCPaint::addLine(int x1, int y1, int x2, int y2){
    }
    
    void FCPaint::addRect(const FCRect& rect){
    }
    
    void FCPaint::addPie(const FCRect& rect, float startAngle, float sweepAngle){
    }

    void FCPaint::addText(String strText, FCFont *font, const FCRect& rect){
        addText(strText, font, rect, -1);
   }

    void FCPaint::addText(String strText, FCFont *font, const FCRect& rect, int width){
    }
    
    void FCPaint::beginPaint(int hDC, const FCRect& wRect, const FCRect& pRect){
        
    }
    
    void FCPaint::beginPath(){
    }
    
    void FCPaint::clearCaches(){
    }
    
    void FCPaint::clipPath(){
    }
    
    void FCPaint::closeFigure(){
    }
    
    void FCPaint::closePath(){
    }
    
    void FCPaint::drawArc(Long dwPenColor, float width, int style, const FCRect& rect, float startAngle, float sweepAngle){
    }
    
    void FCPaint::drawBezier(Long dwPenColor, float width, int style, FCPoint *apt, int cpt){
    }
    
    void FCPaint::drawCurve(Long dwPenColor, float width, int style, FCPoint *apt, int cpt){
    }
    
    void FCPaint::drawEllipse(Long dwPenColor, float width, int style, const FCRect& rect){
    }
    
    void FCPaint::drawEllipse(Long dwPenColor, float width, int style, int left, int top, int right, int bottom){
    }
    
    void FCPaint::drawImage(String imagePath, const FCRect& rect){
    }
    
    void FCPaint::drawLine(Long dwPenColor, float width, int style, const FCPoint& x, const FCPoint& y){
    }
    
    void FCPaint::drawLine(Long dwPenColor, float width, int style, int x1, int y1, int x2, int y2){
    }
    
    void FCPaint::drawPath(Long dwPenColor, float width, int style){
    }
    
    void FCPaint::drawPie(Long dwPenColor, float width, int style, const FCRect& rect, float startAngle, float sweepAngle){
    }
    
    void FCPaint::drawPolygon(Long dwPenColor, float width, int style, FCPoint *apt, int cpt){
    }
    
    void FCPaint::drawPolyline(Long dwPenColor, float width, int style, FCPoint *apt, int cpt){
    }
    
    void FCPaint::drawRect(Long dwPenColor, float width, int style, int left, int top, int right, int bottom){
    }
    
    void FCPaint::drawRect(Long dwPenColor, float width, int style, const FCRect& rect){
    }
    
    void FCPaint::drawRoundRect(Long dwPenColor, float width, int style, const FCRect& rect, int cornerRadius){
    }

    void FCPaint::drawText(String strText, Long dwPenColor, FCFont *font, const FCRect& rect){
        drawText(strText, dwPenColor, font, rect, -1);
    }
    
    void FCPaint::drawText(String strText, Long dwPenColor, FCFont *font, const FCRect& rect, int width){
    }

    void FCPaint::drawText(String strText, Long dwPenColor, FCFont *font, const FCRectF& rect){
        drawText(strText, dwPenColor, font, rect, -1);
    }
    
    void FCPaint::drawText(String strText, Long dwPenColor, FCFont *font, const FCRectF& rect, int width){
    }
    
    void FCPaint::drawTextAutoEllipsis(String strText, Long dwPenColor, FCFont *font, const FCRect& rect){
    }
    
    void FCPaint::endPaint(){
    }
    
    void FCPaint::excludeClipPath(){
    }
    
    void FCPaint::fillEllipse(Long dwPenColor, const FCRect& rect){
    }
    
    void FCPaint::fillGradientEllipse(Long dwFirst, Long dwSecond, const FCRect& rect, int angle){
    }
    
    void FCPaint::fillGradientPath(Long dwFirst, Long dwSecond, const FCRect& rect, int angle){
    }
    
    void FCPaint::fillGradientPolygon(Long dwFirst, Long dwSecond, FCPoint *apt, int cpt, int angle){
    }
    
    void FCPaint::fillGradientRect(Long dwFirst, Long dwSecond, const FCRect& rect, int cornerRadius, int angle){
    }
    
    void FCPaint::fillPath(Long dwPenColor){
    }
    
    void FCPaint::fillPie(Long dwPenColor, const FCRect& rect, float startAngle, float sweepAngle){
    }
    
    void FCPaint::fillPolygon(Long dwPenColor, FCPoint *apt, int cpt){
    }
    
    void FCPaint::fillRect(Long dwPenColor, const FCRect& rect){
    }
    
    void FCPaint::fillRect(Long dwPenColor, int left, int top, int right, int bottom){
    }
    
    void FCPaint::fillRoundRect(Long dwPenColor, const FCRect& rect, int cornerRadius){
    }
    
    Long FCPaint::getColor(Long dwPenColor){
        return 0;
    }
    
    Long FCPaint::getPaintColor(Long dwPenColor){
        return 0;
    }
    
    FCPoint FCPaint::getOffset(){
        FCPoint offset ={0};
        return offset;
    }
    
    void FCPaint::getScaleFactor(double *scaleFactorX, double *scaleFactorY){
        
    }

    void FCPaint::rotate(float angle){
        
    }

    void FCPaint::scale(float sx, float sy){
        
    }

    FCPoint FCPaint::rotate(const FCPoint& op, const FCPoint& mp, int angle){
        FCPoint pt ={0};
        return pt;
    }
    
    void FCPaint::setClip(const FCRect& rect){
    }
    
    void FCPaint::setLineCap(int lineCap){
        
    }

    void FCPaint::setLineJoin(int lineJoin){
        
    }

    void FCPaint::setLineCap(int startLineCap, int endLineCap){
    }
    
    void FCPaint::setOffset(const FCPoint& offset){
        
    }
    
    void FCPaint::setOpacity(float opacity){
    }
    
    void FCPaint::setResourcePath(const String& resourcePath){
    }
    
    void FCPaint::setRotateAngle(int rotateAngle){
        
    }
    
    void FCPaint::setScaleFactor(double scaleFactorX, double scaleFactorY){
    }
    
    bool FCPaint::supportTransparent(){
        return false;
    }

    FCSize FCPaint::textSize(String strText, FCFont *font){
        return textSize(strText, font, -1);
    }
    
    FCSize FCPaint::textSize(String strText, FCFont *font, int width){
        FCSize size ={0};
        return size;
    }

    FCSizeF FCPaint::textSizeF(String strText, FCFont *font){
        return textSizeF(strText, font, -1);
    }
    
    FCSizeF FCPaint::textSizeF(String strText, FCFont *font, int width){
        FCSizeF size ={0};
        return size;
    }

    void FCPaint::translate(float x, float y){
        
    }
}
